package com.cs.archivesmanagement.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by amo on 2015/8/21.
 */
@Entity
@Table(name = "am_archives_priority", schema = "", catalog = "csam")
public class AmArchivesPriority {
    private int archivesPriorityId;
    private Timestamp archivesPriorityTimeBagain;
    private Timestamp archivesPriorityTimeTails;
    private AmArchives archivesPriorityArchiveId;
    private AmAccount archivesPriorityUserId;

    @Id
    @Column(name = "Archives_priority_id", nullable = false, insertable = true, updatable = true)
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    public int getArchivesPriorityId() {
        return archivesPriorityId;
    }

    public void setArchivesPriorityId(int archivesPriorityId) {
        this.archivesPriorityId = archivesPriorityId;
    }

    @Basic
    @Column(name = "Archives_priority_time_bagain", nullable = true, insertable = true, updatable = true)
    public Timestamp getArchivesPriorityTimeBagain() {
        return archivesPriorityTimeBagain;
    }

    public void setArchivesPriorityTimeBagain(Timestamp archivesPriorityTimeBagain) {
        this.archivesPriorityTimeBagain = archivesPriorityTimeBagain;
    }

    @Basic
    @Column(name = "Archives_priority_time_tails", nullable = true, insertable = true, updatable = true)
    public Timestamp getArchivesPriorityTimeTails() {
        return archivesPriorityTimeTails;
    }

    public void setArchivesPriorityTimeTails(Timestamp archivesPriorityTimeTails) {
        this.archivesPriorityTimeTails = archivesPriorityTimeTails;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AmArchivesPriority that = (AmArchivesPriority) o;

        if (archivesPriorityId != that.archivesPriorityId) return false;
        if (archivesPriorityTimeBagain != null ? !archivesPriorityTimeBagain.equals(that.archivesPriorityTimeBagain) : that.archivesPriorityTimeBagain != null)
            return false;
        if (archivesPriorityTimeTails != null ? !archivesPriorityTimeTails.equals(that.archivesPriorityTimeTails) : that.archivesPriorityTimeTails != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = archivesPriorityId;
        result = 31 * result + (archivesPriorityTimeBagain != null ? archivesPriorityTimeBagain.hashCode() : 0);
        result = 31 * result + (archivesPriorityTimeTails != null ? archivesPriorityTimeTails.hashCode() : 0);
        return result;
    }

    @OneToOne
    @JoinColumn(name = "Archives_priority_archive_id", referencedColumnName = "Archives_id")
    public AmArchives getArchivesPriorityArchiveId() {
        return archivesPriorityArchiveId;
    }

    public void setArchivesPriorityArchiveId(AmArchives archivesPriorityArchiveId) {
        this.archivesPriorityArchiveId = archivesPriorityArchiveId;
    }

    @OneToOne
    @JoinColumn(name = "Archives_priority_user_id", referencedColumnName = "Account_id")
    public AmAccount getArchivesPriorityUserId() {
        return archivesPriorityUserId;
    }

    public void setArchivesPriorityUserId(AmAccount archivesPriorityUserId) {
        this.archivesPriorityUserId = archivesPriorityUserId;
    }
}
